package com.ljh.jxc.modules.suo.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ljh.jxc.modules.suo.entity.Alarmdetail;
import com.ljh.jxc.modules.suo.service.AlarmdetailService;
import com.ljh.jxc.common.utils.PageUtils;
import com.ljh.jxc.common.utils.R;



/**
 * 报警明细表
 *
 * @author liujinghui
 * @email liujinghui@163.com
 * @date 2021-12-01 14:17:34
 */
@RestController
@RequestMapping("jxc/alarmdetail")
public class AlarmdetailController {
    @Autowired
    private AlarmdetailService alarmdetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxc:alarmdetail:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = alarmdetailService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{alarmdetailId}")
    @RequiresPermissions("jxc:alarmdetail:info")
    public R info(@PathVariable("alarmdetailId") String alarmdetailId){
		Alarmdetail alarmdetail = alarmdetailService.getById(alarmdetailId);

        return R.ok().put("alarmdetail", alarmdetail);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxc:alarmdetail:save")
    public R save(@RequestBody Alarmdetail alarmdetail){
		alarmdetailService.save(alarmdetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxc:alarmdetail:update")
    public R update(@RequestBody Alarmdetail alarmdetail){
		alarmdetailService.updateById(alarmdetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxc:alarmdetail:delete")
    public R delete(@RequestBody String[] alarmdetailIds){
		alarmdetailService.removeByIds(Arrays.asList(alarmdetailIds));

        return R.ok();
    }

}
